namespace KinonekoSoftware.CodariaDB.Documents.Personalities
{
    public sealed class Favorite : Preference
    {
        private bool _value;

        public Favorite Clone()
        {
            return new Favorite
            {
                Id        = Id,
                Name      = Name,
                SyncFlags = SyncFlags,
            };
        }

        /// <summary>
        /// 获取或设置 <see cref="Value"/> 属性。
        /// </summary>
        public bool Value
        {
            get => _value;
            set => SetValue(ref _value, value);
        }
    }


    public sealed class FavoriteGroup : PreferenceGroup
    {

        public override PreferenceGroup Clone()
        {
            var id = string.IsNullOrEmpty(Id) ? ID.Get() : Id;
            return new FavoriteGroup
            {
                Id    = id,
                Items = new List<Favorite>(Items.Select(x => x.Clone())),
                Intro = Intro,
                Name  = Name,
            };
        }

        public override int Count => Items?.Count ?? 0;

        public List<Favorite> Items { get; set; }
    }
}